<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../lib/Validform/5.3.2/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../ht-css/Project.css" />
    <link rel="stylesheet" type="text/css" href="../../../ht-css/jedate.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>操作日志</title>
</head>
<body>
<nav class="breadcrumb">渠道订单管理 <span class="c-gray en">&gt;</span> <span onclick="returnVer()" style="cursor: pointer">订单详情</span><span class="c-gray en">&gt;</span> 操作日志<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px ;display:block" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
    <form class="ml-20 mr-20" id="appVersionForm"  method="post">
        <div class="bk-gray bg-1 pd-20 text-c">
                <table class="table table-border table-bg table-hover table-sort mt-10" id="datatable">
                    <thead>
                    <tr class="text-c">
                        <th width="50">操作人</th>
                        <th width="50">操作时间</th>
                        <th width="50">日志内容</th>
                    </tr>
                    </thead>
                    <tbody class="shun">

                    </tbody>
                </table>
                <div class="dataTables_wrapper goods_fanye clearfix mt-5">
                    <div class="f-r pageturning M-box3"></div>

            </div>
        </div>
    </form>


</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script src="../../../ht-js/frame/doT.min.js?rev=@@hash"></script>
<script src="../../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../../ht-js/Project.js?rev=@@hash"></script>
<script src="../../../ht-js/operation-js/operation_activity/activity_login.js?rev=@@hash"></script>
<script src="../../../ht-js/contract/jquery-form.js?rev=@@hash"></script>
<!--引入分页-->

<script src="../../../lib/pagination/jquery.pagination.js?rev=@@hash"></script>
<link rel="stylesheet" href="../../../lib/pagination/pagination.css">
<link type="text/css" rel="stylesheet" href="../../../ht-js/operation-js/time-js/jedate.css">
<script type="text/javascript" src="../../../ht-js/operation-js/time-js/jquery.jedate.js?rev=@@hash"></script>
<script>
    seeUpload()
    function seeUpload(){
        $.ajax({
                // url: root.orderInter.queryOperateLogByOrderId,
                url:'https://'+ window.location.host +'/api/admin/apreorder/order/selectOrderOperateLog',
                cache: false, //禁用缓存
                type: "POST",
                dataType:"json",
                contentType: "application/json",
                data:JSON.stringify({
                    "curPage":1,
                    "rows":50,
                    "orderId":sessionStorage.getItem("orderIds"),
                    "orderStatus":sessionStorage.getItem("status")
                }),
                success: function(obj){
                    recordlist(obj.data, 0);
                    var pageCounts=0;
                    if(obj.data!=null&&obj.data!=""){
                        pageCounts=obj.data.totalPage
                    }else {
                        pageCounts=0
                    }
                    $('.M-box3').pagination({
                        pageCount: pageCounts,
                        jump: true,
                        coping: true,
                        prevContent: '上页',
                        nextContent: '下页',
                        callback: function (api) {
                            $.ajax({
                                // url: root.orderInter.queryOperateLogByOrderId,
                                url:'https://'+ window.location.host +'/api/admin/apreorder/order/selectOrderOperateLog',
                                cache: false, //禁用缓存
                                type: "POST",
                                dataType:"json",
                                 contentType: "application/json",
                                data:JSON.stringify({
                                    "curPage":api.getCurrent(),
                                    "rows":50,
                                    "orderId":sessionStorage.getItem("orderIds"),
                                    "orderStatus":sessionStorage.getItem("orderStatus")
                                }),
                                success: function (obj) {
                                    recordlist(obj.data, 0);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    alert(XMLHttpRequest);
                                }
                            });
                        }
                    });
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest);
                }
            }
        )

    }


    var dataSource = new Array();
    //table的数据源
    var table;   //table对象
    dataSource = [];
    function recordlist(data) {
        console.log(data)
        dataSource.splice(0, dataSource.length);//清空数组
        if(data.result!=null){
            $.each(data.result, function (i, field) {
                var rowData = new Array();
                rowData.push(field.operateUsername); //操作人
                rowData.push(field.createdAt); //操作时间
                rowData.push(field.operateContent); //操作内容
                rowData.push(field.operatorRole);
                dataSource.push(rowData);
            });
        }

        initDataTable(dataSource);

        function initDataTable(dataSource) {
            var dttable = $('#datatable').dataTable(); // 初始化dataTable，清空上一个值
            dttable.fnClearTable(); //清空一下table
            dttable.fnDestroy(); //还原初始化了的datatable
            $("#datatable").DataTable({
                "order": [[ 1, "desc" ]],
                "autoWidth": false,
                "ordering": false,
                "searching": false,
                "paging": false,
                "retrieve": true,
                "destroy": true,
                "bAutoWidth": true,
                "bLengthChange": true,
                "aLengthMenu": [5, 10, 25, 50],
                "oLanguage": {
                    "sLengthMenu": "每页显示 _MENU_ 条记录",
                    "sZeroRecords": "抱歉， 没有找到",
                    "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                    "sInfoEmpty": "没有数据",
                    "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                    "oPaginate": {
                        "sFirst": "首页",
                        "sPrevious": "前一页",
                        "sNext": "后一页",
                        "sLast": "尾页"
                    },
                    "sZeroRecords": "没有检索到数据",
                    "sProcessing": "<img src='./loading.gif' />",
                },
                data: dataSource,
                columnDefs: [
                    {
                        "visible": true,
                        "targets": 0
                    },

                    {
                        "render": function (data, type, row, meta) {
                            var val = row[0]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 0
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[1]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 1
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[2]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 2
                    },


                ]
            });
        };
    }

</script>
</body>
</html>